/*
 * @Description:
 * @Version: 2.0
 * @Autor: Seven
 * @Date: 2023-10-07 09:21:31
 * @LastEditors: Seven
 * @LastEditTime: 2023-10-07 09:39:06
 */
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
import { getMonitorInfoData } from "@/services/request";

export const fetchMonitorInfo = createAsyncThunk(
  "fetchMonitor",
  (payload, { diapatch }) => {
    getMonitorInfoData().then((res) => {
      diapatch(changeMonitoringAction(res));
    });
  }
);

const monitoringSlice = createSlice({
  name: "monitorin",
  initialState: {
    goodlist: [],
    monitorInfo: {},
  },
  reducers: {
    changeMonitoringAction(state, { payload }) {
      state.monitorInfo = payload;
    },
  },
});
export default monitoringSlice.reducer;
export const { changeMonitoringAction } = monitoringSlice.actions;
